package com.heima.pri02;

import java.io.*;

public class ZhuanHuanLiu04 {
    public static void main(String[] args) throws IOException {
        //如何解决乱码问题，文件什么码表，咋们就必须用什么码表读取
        //文件是JBK,我们就使用JBK读取
        InputStreamReader in = new InputStreamReader(new FileInputStream("D:\\w.txt"), "gbk");
        int b;
        while ((b = in.read()) != -1) {
            System.out.println((char) b);
        }
        in.close();
        OutputStreamWriter o=new OutputStreamWriter(new FileOutputStream("D:\\w.txt"),"UTF-8");
        o.write("我爱学习");
        o.close();
    }
}
